/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.dao;

import br.com.deployment.entity.orcamento.OrcamentoAto;
import br.com.deployment.daogenerico.DaoGenerico;
import br.com.deployment.entity.orcamento.Orcamento;
import br.com.deployment.interfaces.OrcamentoAtoDaoIn;
import br.com.deployment.interfaces.OrcamentoDaoIn;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author elyjr
 */
@Stateless
@LocalBean
public class OrcamentoAtoDao extends DaoGenerico<OrcamentoAto> implements OrcamentoAtoDaoIn{
    
    public OrcamentoAtoDao(){
        super(OrcamentoAto.class);
    }
    
    public List<OrcamentoAto> buscarOrcamentoAto(Orcamento orc){
            String sql ="";
            
            sql += "Select oa from Orcamento o JOIN o.orcamentoAtos oa where";
            sql += " o.id = :id";
            
            Query query = getEm().createQuery(sql);
            query.setParameter("id", orc.getId());
            System.err.println("Buscar Orcamento Ato"+query.getResultList());
            return query.getResultList();
    }
    
}
